package com.kogi.androidpatt.dealing.main;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import android.view.View;
import android.view.ViewStub;
import android.widget.ExpandableListView;
import com.kogi.patterns.R;
import com.kogi.patterns.dummy;


public class MainListDealing extends Activity{
	
	ViewStub stub,stub2;
	boolean click = true;
	MyExpandableListAdapterDealingData mAdapter;
	private Intent con,dealingData,dynamicList,DragAndDrop;
	
	 @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main_dealing_data);
	        
	        Activity a=this; 
	        ExpandableListView epView = (ExpandableListView) findViewById(R.id.expandableListDealingData);
	        mAdapter = new MyExpandableListAdapterDealingData(a);
	        epView.setAdapter(mAdapter);
	        con = new Intent(MainListDealing.this,dummy.class);
	       
	        dealingData = new Intent(MainListDealing.this,com.kogi.androidpatt.dealing.options.ChangeView.class);
	        dynamicList = new Intent(MainListDealing.this,com.kogi.androidpatt.dealing.dynamiclist.DynamicLoadingList.class);
	        DragAndDrop = new Intent(MainListDealing.this,com.kogi.androidpatt.dealing.draganddrop.DragAndDrop.class);
	        
	        epView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
	            
				@Override
				public boolean onChildClick(ExpandableListView arg0, View arg1,
						int arg2, int arg3, long arg4) {
					
					if(arg2==0 && arg3==0){
						startActivity(dealingData);
					}
					else if(arg2==1 && arg3==0){
						startActivity(dynamicList);
					}
					else if(arg2==4 && arg3==3){
						startActivity(dynamicList);//esta repetido en las listas
					}
					else if(arg2==3 && arg3==0){
						startActivity(DragAndDrop);
					}
					else{
						startActivity(con);
					}
					return false;
				}
	            }); 
	      
	 }
	 
	

}
